package com.alibaba.citrus.ots.unified.inventory.sdo;

import lombok.Data;
import org.apache.commons.collections.MapUtils;

import java.util.Map;

@Data
public class InvoiceOrderDetailSDO {
    /**
     * id
     */
    private Long id;

    /**
     * 主单id
     */
    private Long invoiceOrderId;

    /**
     * 行号
     */
    private String orderLineId;

    /**
     * 货品id
     */
    private String scItemId;

    /**
     * 标题
     */
    private String title;

    /**
     * 价格
     */
    private Long price;

    /**
     * 数量
     */
    private Integer quantity;

    /**
     * 折扣后总金额
     */
    private Long subTotalAmount;

    /**
     * 扩展字段
     */
    private Map<String, String> feature;

    public String getFeatureStr() {
        StringBuilder sb = new StringBuilder();
        if (MapUtils.isEmpty(feature)) {
            return sb.toString();
        }
        for (Map.Entry<String, String> entry : feature.entrySet()) {
            sb.append(entry.getKey()).append(":").append(entry.getValue());
        }
        return sb.toString();
    }
}
